//
//  LogInView.m
//  QuickCure1
//
//  Created by apple on 2016/11/1.
//  Copyright © 2016年 maoge. All rights reserved.
//

#import "LogInView.h"
#import "NetWorkManager.h"


@interface LogInView ()

@property (nonatomic,strong)Users *us;

@end


@implementation LogInView

//加载Xib类方法
+ (instancetype)logIn{
    
    return [[[NSBundle mainBundle]loadNibNamed:@"LogInView" owner:nil options:nil]lastObject];

}

#pragma mark
#pragma mark - 点击登录
- (IBAction)clickButtonLogin:(UIButton *)sender {
    NSString *userName = self.textFileUserName.text;
    NSString *passWord = self.textFilePassWord.text;
    
    [[NetWorkManager sharedManager] loginUserWihtAccount:userName password:passWord successBlock:^(Users *dto) {
        self.us = dto;
        if (self.CompleteBlock) {
            _CompleteBlock(dto);
        }
        NSLog(@"%@",self.us);
    } errorBlock:^(NSString *error) {
        NSLog(@"账号密码错误");
    }];
    
}

#pragma mark
#pragma mark - 点击短信验证登录
- (IBAction)clickButtonToSendMsgForLogin:(UIButton *)sender {
    self.tag = sender.tag;
    [self sendActionsForControlEvents:UIControlEventValueChanged];
}

#pragma mark
#pragma mark - 点击注册
- (IBAction)buttonRegister:(UIButton *)sender {
    self.tag = sender.tag;
    [self sendActionsForControlEvents:UIControlEventValueChanged];
}

#pragma mark
#pragma mark - 点击忘记密码
- (IBAction)buttonForgetPassWord:(UIButton *)sender {
    self.tag = sender.tag;
    [self sendActionsForControlEvents:UIControlEventValueChanged];
}

#pragma mark
#pragma mark - 点击屏幕取消编辑模式
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    
    [self.textFileUserName endEditing:YES];
    [self.textFilePassWord endEditing:YES];
    
}



@end
